﻿using IdentityModel;
using IdentityServer4;
using IdentityServer4.Models;
using IdentityServer4.Test;
using System.Collections.Generic;
using System.Security.Claims;

namespace IdentityServer
{
    public static class Config
    {

        public static IEnumerable<ApiResource> ApiResources() =>
        new List<ApiResource>
        {
             new ApiResource("All", "IdentityServer API")
        };

        public static IEnumerable<ApiScope> ApiScopes() =>
        new List<ApiScope>
        {
            new ApiScope("All", "IdentityServer API")
        };


        public static IEnumerable<Client> GetClients()
        {
            return new List<Client>
            {
                new Client
                {
                    ClientId = "IdentityAuth",
                    AccessTokenLifetime = 43200,
                    AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials,
                    AllowOfflineAccess = true,
                    ClientSecrets =
                    {
                        new Secret("Secret".Sha256())
                    },
                    AllowedScopes = 
                    { 
                        "All"
                    },
                    RequirePkce = false,
                    AlwaysSendClientClaims = true,
                    AlwaysIncludeUserClaimsInIdToken = true,

                }
            };
        }

    }
}